package ${packageCode}.func.vx.${moduleMapperCode}.${businessCode?uncap_first};

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.springframework.stereotype.Component;
import top.cardone.core.util.func.Func1;

import java.util.Map;

/**
 * ${businessName!} - 添加
 */
@Component("/vx/${moduleMapperCode}/${(businessCode?uncap_first)!''}/addModal.json")
public class AddModalFunc implements Func1<Object, Map<String, Object>> {
    private Table<String, String, String> inputConfigTable;

    public AddModalFunc() {
        inputConfigTable = HashBasedTable.create();
<#if (entityMapper??) && (entityMapper.fieldMapperMap??)>
    <#list entityMapper.fieldMapperMap?values as fieldMapper>
		inputConfigTable.put("${fieldMapper.code}", "funcBeanId", "escapeSqlFunc");
    </#list>
</#if>

<#if (entityMapper??) && (entityMapper.fieldMapperMap??)>
    <#list entityMapper.fieldMapperMap?values as fieldMapper>
		inputConfigTable.put("${fieldMapper.columnName}", "newName", "${fieldMapper.code}");
    </#list>
</#if>
    }

    @Override
    public Object func(Map<String, Object> inputMap) {
        inputMap.putAll(top.cardone.context.util.MapUtils.newHashMap(inputMap, inputConfigTable));

        validate(inputMap);
		
        return null;
    }
	
    private  void validate(Map<String,Object>  inputMap){

    }
}
